package com.dongdongshop.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongdongshop.data.Result;
import com.dongdongshop.em.ConstantEnum;
import com.dongdongshop.pojo.TbSeller;
import com.dongdongshop.service.TbSellerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("tbSeller")
public class TbSellerController {
    @Reference
    private TbSellerService tbSellerService;
    @RequestMapping("toTbSeller")
    public String toTb(){
        return "admin/seller";//商家管理
    }
    @RequestMapping("toTbSeller_1")
    public  String toTb_1(){
        return "admin/seller_1";//商家审核
    }
    @RequestMapping("findTbSeller")
    @ResponseBody
    public List<TbSeller> findSeller(){
         List<TbSeller> tbSellers = tbSellerService.finfSeller();
        return tbSellers;
    }
    @RequestMapping("findTbSeller_1")
    @ResponseBody
    public List<TbSeller> findSeller_1(){
        List<TbSeller> tbSellers = tbSellerService.finfSeller();
        return tbSellers;
    }
    @RequestMapping("echoSeller")
    @ResponseBody
    public TbSeller toEcho(String sellerId){
       TbSeller tbSeller =  tbSellerService.selectById(sellerId);
       return tbSeller;
    }
    @ResponseBody
    @RequestMapping("upServller")
    public Result toUP(TbSeller tbSeller){
        tbSellerService.updateServller(tbSeller);
        return  Result.build(ConstantEnum.SUCCESS);
    }
}
